package com.example.certificate.controller;


import com.example.certificate.annoatiton.LoginToken;
import com.example.certificate.dto.RoleDto;
import com.example.certificate.dto.common.DelByIdDto;
import com.example.certificate.service.SysRoleJurisdictionService;
import com.example.certificate.utils.ResultEntity;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author hao
 * @since 2022-02-24 15:05:25
 */
@RestController
@RequestMapping("/domain/sysRoleJurisdiction")
public class SysRoleJurisdictionController {

    @Autowired
    private SysRoleJurisdictionService jurisdictionService;


    @LoginToken
    @ApiOperation(value = "角色权限设置")
    @PostMapping(value = "/insertRole")
    public ResultEntity insertRole(@RequestBody RoleDto dto){
        return jurisdictionService.insertRole(dto);
    }

    @LoginToken
    @ApiOperation(value = "查询角色权限")
    @PostMapping(value = "/getRoleData")
    public ResultEntity getRoleData(@Validated(value = {DelByIdDto.delDataById.class}) @RequestBody DelByIdDto dto){
        return new ResultEntity(jurisdictionService.getRoleData(dto));
    }
}

